<?php
class m_dangnhap extends CI_Model{
    function __construct() {
        parent::__construct();
        $this->load->database();
    }
    function getalldata(){
        $this->db->select('*');
        $this->db->from('nguoidung');
        $this->db->limit($off,$limit);
        $this->db->order_by('MaNguoiDung','asc');
        $query = $this->db->get();
        $data= $query->result_array();
        return $data;
    }
    function check_login($user,$pass){
        $this->db->select('*');
       
        $this->db->where('TenDangNhap',$user);
        $this->db->where('MatKhau',md5($pass));
        $query = $this->db->get("nguoidung");        
        if($query->num_rows()==0){
            return FALSE;
        }
        else{
            return $query->row_array();
        }
    }
    function Layhotenquausername($user,$pass){
        $this->db->select('*');
        $this->db->where("TenDangNhap",$user);
        $this->db->where('MatKhau',md5($pass));
        $query = $this->db->get("nguoidung");
        $data= $query->result();
        return $data;
       
    }
}
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
?>
